#include "../src/common.h"
using namespace xege;

WINDOW win (800, 600);
Uint32 draw (Uint32 interval, void* param) {
	int x = rand () % 800, y = rand () % 600;
	win.drawFillCircle (x, y, rand ()%40+10);
	// SDL_Log ("%d", *(int*)param);
	return 1;
}

int main () {
	// SDL_TimerCallback
	int x = 2;
	SDL_Event gEvent {};
	bool windowIsRun = true;
	// putImage 区
	// putFont  区
	// win.updateTexture ();
	SDL_TimerID s =  SDL_AddTimer (200, draw, &x);
	SDL_Delay (2000);
	// SDL_RemoveTimer (s);
	// win.draw 区
	win.update ();
	win.clear ();
	while (windowIsRun) {
		// while (SDL_PollEvent (&gEvent)) {
			switch (SDL_PollEvent (&gEvent); gEvent.type) {
			case SDL_QUIT:
				windowIsRun = false; 
				win.close ();
				SDL_Quit ();
			break;
			case SDL_MOUSEBUTTONDOWN: 

			break;
			case SDL_MOUSEBUTTONUP: 

			break;
			// case sdl
			default: 

			break;
			}
			// putImage 区
			// putFont  区
			// win.updateTexture ();
			// win.draw 区
			win.update ();
			win.clear ();
			// SDL_Delay (30.0/60*1000);
		// }
	}


	return 0;
}